package ode

import (
	"log"
	"net/url"
	"net/http"
)

const apiURL = "http://askodie.com/connect"

type matcher struct {
	url.Values
	Patterns []string
}

func NewMatcher() *matcher {

	return &matcher{url.Values{}, []string{}}
}

func (m *matcher) AddPattern(p, endpoint string) {

	_, err := url.Parse(endpoint)

	if err != nil {
		panic(err)
	}

	m.Values.Add(p, endpoint)
	m.Patterns = append(m.Patterns, p)
}

func (m *matcher) Connect() {

	log.Println("connecting")
	http.PostForm(apiURL, m.Values)
	panic ("disconnected")
}
